package cn.tedu._05egmvc1.Controller;

import ch.qos.logback.core.joran.util.beans.BeanUtil;
import cn.tedu._05egmvc1.mapper.AddressMapper;
import cn.tedu._05egmvc1.pojo.entity.Address;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class AddressController {
    @Autowired
    private AddressMapper addressMapper;
@RequestMapping(value = "/address/insert")
    public String insertAddress(Address address){
        addressMapper.insert(address);
        return "添加成功";
    };

@RequestMapping(value = "/address/select")
public List<Address> selectAdress(Address address){
return  addressMapper.select(address);
}
@RequestMapping(value = "/address/delete")
public String deleteAddress(int id){
addressMapper.delete(id);
    return "删除成功";
}

@RequestMapping(value = "/address/update")
public String update(Address address){
    addressMapper.update(address);
    return "修改成功";
}
}
